<!DOCTYPE html>
<html class="no-js" lang="">
<head>#include( "/public-head.html")
</head>

<body style="background-color: #ffffff !important;">
	<!-- main area -->
	<div class="main-content checkbo">
		<div class="panel mb25">
			<div class="panel-heading border">#if($!permission.permissionId) 编辑#else 添加#end权限</div>
			<div class="panel-body">
				<div class="row no-margin">
					<div class="col-lg-12">
						<form action="/vrs/permission/edit.jsn" data-url="/vrs/permission/list.jsn" id="permissionForm" name="ajaxForm"
							class="form-horizontal bordered-group" role="form">
							<input type="hidden" name="permission.permissionId" value="$!{permission.permissionId}">
							<div class="form-group">
								<label class="col-sm-2 control-label">权限名称</label>
								<div class="col-sm-10">
									<input type="text" required name="permission.name" value="$!{permission.name}" class="form-control w150" placeholder="权限名称">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">Url</label>
								<div class="col-sm-10">
									<input type="text" name="permission.url" value="$!{permission.url}" class="form-control w150" placeholder="Url">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">描述</label>
								<div class="col-sm-10">
									<input type="text"  ame="permission.description" value="$!{permission.description}" class="form-control w150" placeholder="描述">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">父节点</label>
								<input  type="hidden" id="perId2" >
								<input  type="hidden" id="perName2" >
									 
								<div class="col-sm-10">
									<input readonly="readonly" required type="text" id="perName"
									 class="form-control w150" placeholder="父节点" value="$!{parentName}"  
									 data-toggle="modal" data-target=".bs-modal-sm" >
									 
									<input  readonly="readonly" type="hidden" id="perId" name="permission.parentId" 
									 value="$!{permission.parentId}"  class="form-control w150" placeholder="父节点" 
									 data-toggle="modal" data-target=".bs-modal-sm" >
								</div>
							</div>
							<div class="form-group">
								<label></label>
								<div>
									<button type="button" onclick="submitPerForm()" class="btn btn-primary mr10">#if($!permission.permissionId) 修改#else 保存#end</button>
									<button class="btn btn-default">返回</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>

	</div>
<!--modal-->
	<div  class="modal bs-modal-sm" tabindex="-1" role="dialog" aria-hidden="true">
	
	    <form id="modalForm">
	        <div class="modal-dialog">
	            <div class="modal-content">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
	                    <h4 class="modal-title">选择创建节点</h4>
	                </div>
	                <div class="modal-body" style="max-height: 250px;">
	                    <p>菜单树</p>
	                    <div id="treeDemo" class="ztree"></div>
	                </div>
	                <div class="modal-footer no-border">
	                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	                    <button type="button" class="btn btn-primary save" data-dismiss="modal"  onclick="savePerent();">保存</button>
	                </div>
	            </div>
	        </div>
	    </form>
	</div>
<!--modal-->
	<!-- /main area -->

	#include( "/public-script.html")
	#include( "/sub-script.html")
	<script>
		//初始化
		$('#permissionForm').validate();
		
		
		//父节点选择
		var treeMenu = [{"id":0,"name":"VRS系统","children":$!{menu}}];
		funCreateRadioTree("treeDemo",treeMenu,onTreeRadioFun,null);
		function onTreeRadioFun(e, treeId, treeNode) {
			$("#perName2").val(treeNode.name);
			$("#perId2").val(treeNode.id);
		}
		function savePerent(){
			$("#perName").val($("#perName2").val());
			$("#perId").val($("#perId2").val());
		}

		//提交
		function submitPerForm() {
			if (!$('#permissionForm').valid()) {
				return false;
			} else {
				$('#permissionForm').submit();
			}
		}
	</script>
</body>

</html>
